package com.kurancy.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ManyToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord(finders = { "findKurancyUsersByFacebookUserIdEquals" })
public class KurancyUser {

    @NotNull
    @Size(min = 2, max = 100)
    private String firstName;

    @NotNull
    @Size(min = 2, max = 100)
    private String lastName;

    @NotNull
    private String facebookUserId;

    @NotNull
    @Size(min = 7, max = 100)
    private String email;

    @Value("true")
    private Boolean isActive;

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "MM/dd/yyyy hh:mm:ss a")
    private Date createdOn;

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "MM/dd/yyyy hh:mm:ss a")
    private Date modifiedOn;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<KurancyCreated> kuranciesCreated = new HashSet<KurancyCreated>();

    @Size(min = 2, max = 200)
    private String paypalCredential;

    @Size(min = 8, max = 25)
    private String password;

    @NotNull(message="City is required.")
    @Size(min = 2, max = 150,message="City is required.")
    private String city;

    @NotNull(message="State is required.")
    @Size(min = 2, max = 2,message="State is required.")
    private String stateAbbr;
}
